package com.wpen.unit.web.controller.job;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wpen.unit.service.job.TaskInfoService;
import com.wpen.unit.web.dto.job.TaskInfoAddRequest;
import com.wpen.unit.web.dto.job.TaskInfoAddResponse;
import com.wpen.unit.web.dto.job.TaskInfoDelRequest;
import com.wpen.unit.web.dto.job.TaskInfoDelResponse;
import com.wpen.unit.web.dto.job.TaskInfoEnableRequest;
import com.wpen.unit.web.dto.job.TaskInfoEnableResponse;
import com.wpen.unit.web.dto.job.TaskInfoListRequest;
import com.wpen.unit.web.dto.job.TaskInfoListResponse;
import com.wpen.unit.web.dto.job.TaskInfoModRequest;
import com.wpen.unit.web.dto.job.TaskInfoModResponse;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

/**
 * 任务信息维护
 * 
 * @author pg
 *
 */
@Tag(name = "任务信息模块服务接口")
@RestController
@RequestMapping("/api")
public class TaskInfoController {
    @Autowired
    private TaskInfoService taskInfoService;

    @Operation(summary = "任务信息-列表查询")
    @PostMapping(value = "/taskInfo/list", produces = MediaType.APPLICATION_JSON_VALUE)
    public TaskInfoListResponse queryListTaskInfo(@RequestBody @Valid TaskInfoListRequest taskInfoListRequest) {
        return taskInfoService.queryListTaskInfo(taskInfoListRequest);
    }

    @Operation(summary = "任务信息-新增")
    @PostMapping(value = "/taskInfo/add", produces = MediaType.APPLICATION_JSON_VALUE)
    public TaskInfoAddResponse addTaskInfo(@RequestBody @Valid TaskInfoAddRequest taskInfoAddRequest) {
        return taskInfoService.addTaskInfo(taskInfoAddRequest);
    }

    @Operation(summary = "任务信息-修改")
    @PostMapping(value = "/taskInfo/mod", produces = MediaType.APPLICATION_JSON_VALUE)
    public TaskInfoModResponse modTaskInfo(@RequestBody @Valid TaskInfoModRequest taskInfoModRequest) {
        return taskInfoService.modTaskInfo(taskInfoModRequest);
    }

    @Operation(summary = "任务信息-启停")
    @PostMapping(value = "/taskInfo/enable", produces = MediaType.APPLICATION_JSON_VALUE)
    public TaskInfoEnableResponse enableTaskInfo(@RequestBody @Valid TaskInfoEnableRequest taskInfoEnableRequest) {
        return taskInfoService.enableTaskInfo(taskInfoEnableRequest);
    }

    @Operation(summary = "任务信息-删除")
    @PostMapping(value = "/taskInfo/del", produces = MediaType.APPLICATION_JSON_VALUE)
    public TaskInfoDelResponse delTaskInfo(@RequestBody @Valid TaskInfoDelRequest taskInfoDelRequest) {
        return taskInfoService.delTaskInfo(taskInfoDelRequest);
    }

}
